package cn.lger.icollege.controller;

import cn.lger.icollege.dao.NoticeDao;
import cn.lger.icollege.dao.TeacherDao;
import cn.lger.icollege.entity.AttendanceRecord;
import cn.lger.icollege.entity.Teacher;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Code that Changed the World
 * Pro said
 * Created by Pro on 2018-04-14.
 */
@Controller
public class HelloController {

    @GetMapping("/hello")
    public String getHelloView(){
        return "/hello.btl";
    }

    @GetMapping("/{status}/hello")
    public String getHelloView(@PathVariable String status, Model model){
        model.addAttribute("status", status);
        return "/hello.btl";
    }

    @Resource
    private TeacherDao teacherDao;

    @Resource
    private NoticeDao noticeDao;

    @GetMapping("/json")
    @ResponseBody
    public AttendanceRecord getJson(){
        return null;
    }


    @GetMapping("/TEST/{id}")
    public String TEST(@PathVariable String id){
        System.out.println(id);
        return "/index.html";
    }

    @GetMapping("/test01")
    public String test01(){
        int i = 1 / 0;
        return "/stu-attendance.btl";
    }


    @GetMapping("/test03")
    public String test03(){
        return "/loginpage.btl";
    }


    @PostMapping("/test02")
    @ResponseBody
    public String test02(HttpServletRequest request, String address, MultipartFile file){
        return "/stu-info.btl";
    }

}
